/*
 * $Id: DirectionsLeg.java 42 2013-04-17 15:33:59Z gabakyan $
 * $Author: gabakyan $
 * $Revision: 42 $
 * $Date: 2013-04-17 15:33:59 +0000 (Wed, 17 Apr 2013) $
 *
 * Copyright (c) 2013 Supply Chain Intelligence (SCI), Inc.
 * http://www.scintelligence.com/, Email: info@scintelligence.com
 * All rights reserved.
 *
 * This file is part of Logistics Map.
 *
 * Logistics Map is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, version 3 of the License.
 *
 * Logistics Map is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Logistics Map.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.sci.logisticsmap.support.model.geocoding;

import java.io.Serializable;
import java.util.List;

/**
 * The interface {@code DirectionsLeg} represents the geocoding directions leg.
 *
 * @author gabakyan@gmail.com (Last modified by $Author: gabakyan $)
 * @version $Revision: 42 $
 */
public class DirectionsLeg implements Serializable {
    /**
     * The serial version id.
     */
    private static final long serialVersionUID = 1L;

    /**
     * The steps.
     */
    private List<DirectionsStep> steps;
    /**
     * The duration.
     */
    private DirectionsDuration duration;
    /**
     * The distance.
     */
    private DirectionsDistance distance;
    /**
     * The start location.
     */
    private LatLng startLocation;
    /**
     * The end location.
     */
    private LatLng endLocation;
    /**
     * The start address.
     */
    private String startAddress;
    /**
     * The end address.
     */
    private String endAddress;

    /**
     * Gets the steps.
     *
     * @return The steps.
     */
    public List<DirectionsStep> getSteps() {
        return steps;
    }

    /**
     * Sets the steps.
     *
     * @param steps The steps.
     */
    public void setSteps(List<DirectionsStep> steps) {
        this.steps = steps;
    }

    /**
     * Gets the duration.
     *
     * @return The duration.
     */
    public DirectionsDuration getDuration() {
        return duration;
    }

    /**
     * Sets the duration.
     *
     * @param duration The duration.
     */
    public void setDuration(DirectionsDuration duration) {
        this.duration = duration;
    }

    /**
     * Gets the distance.
     *
     * @return The distance.
     */
    public DirectionsDistance getDistance() {
        return distance;
    }

    /**
     * Sets the distance.
     *
     * @param distance The distance.
     */
    public void setDistance(DirectionsDistance distance) {
        this.distance = distance;
    }

    /**
     * Gets the start location.
     *
     * @return The start location.
     */
    public LatLng getStartLocation() {
        return startLocation;
    }

    /**
     * Sets the start location.
     *
     * @param startLocation The start location.
     */
    public void setStartLocation(LatLng startLocation) {
        this.startLocation = startLocation;
    }

    /**
     * Gets the end location.
     *
     * @return The end location.
     */
    public LatLng getEndLocation() {
        return endLocation;
    }

    /**
     * Sets the end location.
     *
     * @param endLocation The end location.
     */
    public void setEndLocation(LatLng endLocation) {
        this.endLocation = endLocation;
    }

    /**
     * Gets the start address.
     *
     * @return The start address.
     */
    public String getStartAddress() {
        return startAddress;
    }

    /**
     * Sets the start address.
     *
     * @param startAddress The start address.
     */
    public void setStartAddress(String startAddress) {
        this.startAddress = startAddress;
    }

    /**
     * Gets the end address.
     *
     * @return The end address.
     */
    public String getEndAddress() {
        return endAddress;
    }

    /**
     * Sets the end address.
     *
     * @param endAddress The end address.
     */
    public void setEndAddress(String endAddress) {
        this.endAddress = endAddress;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        DirectionsLeg that = (DirectionsLeg) o;

        if (distance != null ? !distance.equals(that.distance) : that.distance != null) return false;
        if (duration != null ? !duration.equals(that.duration) : that.duration != null) return false;
        if (endAddress != null ? !endAddress.equals(that.endAddress) : that.endAddress != null) return false;
        if (endLocation != null ? !endLocation.equals(that.endLocation) : that.endLocation != null) return false;
        if (startAddress != null ? !startAddress.equals(that.startAddress) : that.startAddress != null) return false;
        if (startLocation != null ? !startLocation.equals(that.startLocation) : that.startLocation != null)
            return false;
        if (steps != null ? !steps.equals(that.steps) : that.steps != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = steps != null ? steps.hashCode() : 0;
        result = 31 * result + (duration != null ? duration.hashCode() : 0);
        result = 31 * result + (distance != null ? distance.hashCode() : 0);
        result = 31 * result + (startLocation != null ? startLocation.hashCode() : 0);
        result = 31 * result + (endLocation != null ? endLocation.hashCode() : 0);
        result = 31 * result + (startAddress != null ? startAddress.hashCode() : 0);
        result = 31 * result + (endAddress != null ? endAddress.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "DirectionsLeg{" +
                "steps=" + steps +
                ", duration=" + duration +
                ", distance=" + distance +
                ", startLocation=" + startLocation +
                ", endLocation=" + endLocation +
                ", startAddress='" + startAddress + '\'' +
                ", endAddress='" + endAddress + '\'' +
                '}';
    }
}
